<!--仓单的批量预览界面-->
{% extends "layout.html" %}
{% block __data_browser__custom_external_block %}
  {{ super() }}
  <link rel="stylesheet" href="{{ url_for('static', filename="css/customer.css") }}" media="print">
  <script src="{{ url_for("static", filename="js/jquery-printarea.js") }}" type="text/javascript"></script>
  <script type="text/javascript" src="{{ url_for("static",filename="js/jquery-barcode.min.js") }}"></script>
  <script type="text/javascript">
    $(function () {
      $("#print").click(function () {
        $("#printArea").printArea();
      });
      {% for store_bill in store_bill_list %}
        $("#bcTarget-{{ store_bill.id }}").barcode("{{ store_bill.create_time.strftime("%Y%m%d%H%M%S") + store_bill.id|string }}", "code128", {barWidth: 3});
      {% endfor %}
    });
  </script>
{% endblock %}
{% block body %}
  <div class="row">
    <div class="col-lg-6 col-lg-offset-3">
      <div id="printArea">
        {% for store_bill in store_bill_list %}
          <div {% if not loop.last %}class="page-next" {% endif %}>
            <table class="table table-striped table-bordered table-condensed">
              <tbody>
              <tr>
                <th colspan="3"><h4 class="text-center">金禾域加工仓单</h4></th>
              </tr>
              <tr>
                <th>仓单号</th>
                <td colspan="2"><p class="center">{{ store_bill.id }}</p>
                </td>
              </tr>
              <tr>
                <th>工单号</th>
                <td colspan="2"><p
                    class="center">{{ store_bill.qir.work_command_id }}</p>
                </td>
              </tr>
              <tr>
                <th>客户名称</th>
                <td colspan="2"><p
                    class="center">{{ store_bill.customer.name }}</p>
                </td>
              </tr>
              <tr>
                <th>产品名称</th>
                <td colspan="2"><p
                    class="center">{{ store_bill.product_name }}</p>
                </td>
              </tr>
              <tr>
                <th>存放点</th>
                <td colspan="2">
                  <p id="harbor">{{ store_bill.harbor.name if store_bill.harbor or "" }}</p>
                </td>
              </tr>
              <tr>
                <th>{{ "大约" if not store_bill.delivery_task }}净重{% if not store_bill.sub_order.measured_by_weight %}
                  / 数量{% endif %}</th>
                <td colspan="2">
                  <p class="center">
                    {{ store_bill.weight }}(公斤){% if not store_bill.sub_order.measured_by_weight %}
                    / {{ store_bill.quantity }}({{ store_bill.unit }}){% endif %}
                  </p>
                </td>
              </tr>
              {% if not store_bill.sub_order.measured_by_weight %}
                <tr>
                  <th>规格 - 型号</th>
                  <td>
                    <p class="center">{{ (store_bill.sub_order.spec, store_bill.sub_order.type)|join(" - ") }}</p>
                  </td>
                </tr>
              {% endif %}
              <tr>
                <th>生成日期</th>
                <td colspan="2"><p
                    class="center">{{ store_bill.create_time }}</p>
                </td>
              </tr>
              <tr>
                <th>子订单号</th>
                <td colspan="2"><p
                    class="center">{{ store_bill.sub_order.id }}</p>
                </td>
              <tr>
                <th>订单编号</th>
                <td colspan="2">
                  <p class="center">{{ store_bill.sub_order.order.customer_order_number }}</p>
                </td>
              </tr>
              <tr>
                <td colspan="3">
                  <div id="bcTarget-{{ store_bill.id }}" class="center-block" name="bcTarget"></div>
                </td>
              </tr>
              </tbody>
            </table>
          </div>{% endfor %}
      </div>
      <div class="text-center">
        <button class="btn btn-primary btn-lg" id="print">
          <i class="fa fa-print fa-fw"></i>{{ _("打印") }}
        </button>
        <a href="{{ request.args.get("url") or url_for("store_bill.store_bill",id_=store_bill.id) }}" class="btn btn-lg btn-default">
          <i class="fa fa-step-backward fa-fw"></i>{{ _("返回") }}
        </a>
      </div>
    </div>
  </div>
{% endblock %}


